/*  1:   */ package org.jetbrains.debugger.frame;
/*  2:   */ 
/*  3:   */

import com.intellij.xdebugger.frame.XExecutionStack;
import com.intellij.xdebugger.frame.XExecutionStack.XStackFrameContainer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.debugger.*;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */
/* 16:   */
/* 17:   */
/* 18:   */
/* 19:   */ 
/* 20:   */ public class ExecutionStackImpl
/* 21:   */   extends XExecutionStack
/* 22:   */ {
/* 23:   */   private final SuspendContext a;
/* 24:   */   private final Script b;
/* 25:   */   private CallFrameView c;
/* 26:   */   private final DebuggerViewSupport d;
/* 27:   */   
/* 28:   */   public ExecutionStackImpl(@NotNull SuspendContext paramSuspendContext, @NotNull DebuggerViewSupport paramDebuggerViewSupport, @Nullable Script paramScript)
/* 29:   */   {
/* 30:20 */     super("");
/* 31:   */     
/* 32:22 */     this.d = paramDebuggerViewSupport;
/* 33:23 */     this.a = paramSuspendContext;
/* 34:24 */     this.b = paramScript;
/* 35:   */   }
/* 36:   */   
/* 37:   */   @Nullable
/* 38:   */   public CallFrameView getTopFrame()
/* 39:   */   {
/* 40:30 */     CallFrame localCallFrame = this.a.getTopFrame();
/* 41:31 */     if ((this.c == null) || (this.c.getCallFrame() != localCallFrame)) {
/* 42:32 */       this.c = (localCallFrame == null ? null : new CallFrameView(localCallFrame, this.d, this.b));
/* 43:   */     }
/* 44:34 */     return this.c;
/* 45:   */   }
/* 46:   */   
/* 47:   */   public void computeStackFrames(final int paramInt, final XExecutionStack.XStackFrameContainer paramXStackFrameContainer)
/* 48:   */   {
/* 49:39 */     SuspendContext localSuspendContext = this.d.getVm().getSuspendContextManager().getContextOrFail();
/* 50:40 */     localSuspendContext.getCallFrames().doWhenDone(new ContextDependentAsyncResultConsumer(localSuspendContext)
/* 51:   */     {
/* 52:   */       protected void consume(CallFrame[] paramAnonymousArrayOfCallFrame, @NotNull Vm paramAnonymousVm)
/* 53:   */       {
/* 54:43 */         if (paramAnonymousVm == null) {
/* 55:43 */           throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/frame/ExecutionStackImpl$1", "consume" }));
/* 56:   */         }
/* 57:43 */         int i = paramAnonymousArrayOfCallFrame.length - paramInt;
/* 58:   */         Object localObject;
/* 59:45 */         if (i < 1)
/* 60:   */         {
/* 61:46 */           localObject = Collections.emptyList();
/* 62:   */         }
/* 63:   */         else
/* 64:   */         {
/* 65:49 */           localObject = new ArrayList(i);
/* 66:50 */           for (int j = paramInt; j < paramAnonymousArrayOfCallFrame.length; j++)
/* 67:   */           {
/* 68:51 */             CallFrame localCallFrame = paramAnonymousArrayOfCallFrame[j];
/* 69:   */             
/* 70:53 */             Script localScript = paramAnonymousVm.getScriptManager().getScript(localCallFrame);
/* 71:54 */             if (localScript != null) {
/* 72:55 */               ((List)localObject).add(new CallFrameView(localCallFrame, ExecutionStackImpl.this.d, localScript));
/* 73:   */             }
/* 74:   */           }
/* 75:   */         }
/* 76:59 */         paramXStackFrameContainer.addStackFrames((List)localObject, true);
/* 77:   */       }
/* 78:   */     });
/* 79:   */   }
/* 80:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.debugger.frame.ExecutionStackImpl

 * JD-Core Version:    0.7.0.1

 */